package org.teamh.logic.datamodel;

import java.util.HashMap;



public class TowerTypeToTowerMapping {

	private Guide guide;
	private String ID;
	private String name;
	private HashMap<String, TowerDescription> towerDescriptions = new HashMap<String, TowerDescription>();
	
	public TowerTypeToTowerMapping(String ID) {
		this.ID = ID;
	}
	
	public void setGuide(Guide guide) {
		if(this.guide != guide) {
			if(getGuide() != null) {
				getGuide().removeTowerTypeToTowerMapping(this);
			}
			this.guide= guide;
			if(getGuide() != null) {
				getGuide().addTowerTypeToTowerMapping(this);
			}
		}
	}
	
	public void addTowerDescription(TowerDescription towerDescription) {
		if(!towerDescriptions.containsKey(towerDescription.getID())) {
			towerDescriptions.put(towerDescription.getID(), towerDescription);
			towerDescription.setTowerTypeToTowerMapping(this);
		}
	}
	
	public void removeTowerDiscription(TowerDescription towerDescription) {
		if(towerDescriptions.remove(towerDescription.getID()) != null) {
			towerDescription.setTowerTypeToTowerMapping(null);
		}
	}
	
	public Guide getGuide() {
		return guide;
	}

	public String getID() {
		return ID;
	}

	public void setID(String ID) {
		this.ID = ID;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public TowerDescription getTowerDescription(String ID) {
		return towerDescriptions.get(ID);
	}
	
}
